import 'package:flutter/material.dart';

class ScrollCase extends StatelessWidget {
  const ScrollCase({super.key});

  @override
  Widget build(BuildContext context) {
    // SingleChildScrollView 垂直滚动
    return SingleChildScrollView(
      scrollDirection: Axis.vertical,
      child: Column(
        // map 方法：数据列表 转换成 组件列表，最后记得 .toList()
        children: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map((int item) {
          return Container(
            height: 100,
            margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
            width: double.infinity,
            color: Colors.red,
            child: Text(item.toString()),
          );
        }).toList(),
      ),
    );
  }
}
